package com.dream.xiaobo.entity;

import java.util.List;

/**
 * @author xiaobo
 * @date 2021/8/31 - 11:08
 */
public class PageBean<T> {

    //列表集合
    private List<T> list;
    //当前页码
    private Integer currentPage;
    //每页显示数量
    private Integer pageSize;
    //总数据条数
    private Long totalCount;
    //总页码
    private Integer totalPage;

    public PageBean(List<T> list, Integer currentPage, Integer pageSize, Long totalCount) {
        this.list = list;
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getTotalPage() {

        //向上取余
        return Integer.valueOf((int) Math.ceil(totalCount * 1.0 / pageSize));
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

}
